import java.util.Locale;

public class demo1 {
    public static boolean isPalindrome(String s) {
        s.toLowerCase();
        char []arr=new char[s.length()];
        if(s.length()==1){
            return true;
        }
        int index=0;
        for(int i=0;i<s.length();i++){
            char temp=s.charAt(i);
            if(('a'<=temp&&temp<='z')||(temp>='0'&&temp<='9')){
                arr[index]=temp;
                index++;
            }
        }
        int i=0;
        while (i<index){
            if(arr[i]==arr[index-1]){
                i++;
                index--;
            }
            else {
                return false;
            }
        }
        return true;
    }

    public static void main(String[] args) {
        String s="A man, a plan, a canal: Panama";
        System.out.println(isPalindrome(s));
    }
}
